/*
   @Copyright:LeetCode
   @Author:   tjyemail
   @Problem:  http://leetcode.com/problems/single-number-ii
   @Language: C++
   @Datetime: 19-11-18 14:23
   */

class Solution {
public:
	int singleNumber(vector<int>& nums) {
		int one=0, two=0;
		for(const int &num:nums){
			one = one ^ num & ~two;
			two = two ^ num & ~one;
		}
		return one;
	}
};
